using System.ComponentModel.DataAnnotations;
 using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class EventMap : EntityTypeConfiguration<Event>
    {
        public EventMap()
        {
            // Primary Key
            this.HasKey(t => t.Event_id);

            // Properties
            this.Property(t => t.Title)
                .HasMaxLength(30);

            this.Property(t => t.Content)
                .HasMaxLength(1000);

            this.Property(t => t.BtnText)
                .HasMaxLength(25);

            this.Property(t => t.UniqueCode)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.AgeGroups)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.RelatedToSchools)
                .IsRequired()
                .HasMaxLength(8000);

            this.Property(t => t.CustomTime)
                .HasMaxLength(50);

            this.Property(t => t.ImageIds)
                .HasMaxLength(50);

            this.Property(t => t.Country)
                .IsRequired()
                .HasMaxLength(2);

            this.Property(t => t.RelatedToCities)
                .HasMaxLength(1200);

            // Table & Column Mappings
            this.ToTable("Event");
            this.Property(t => t.Event_id).HasColumnName("Event_id");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.Content).HasColumnName("Content");
            this.Property(t => t.BtnText).HasColumnName("BtnText");
            this.Property(t => t.UniqueCode).HasColumnName("UniqueCode");
            this.Property(t => t.EventType).HasColumnName("EventType");
            this.Property(t => t.AgeGroups).HasColumnName("AgeGroups");
            this.Property(t => t.RelatedToSchools).HasColumnName("RelatedToSchools");
            this.Property(t => t.IsForStudents).HasColumnName("IsForStudents");
            this.Property(t => t.StartTime).HasColumnName("StartTime");
            this.Property(t => t.EndTime).HasColumnName("EndTime");
            this.Property(t => t.CustomTime).HasColumnName("CustomTime");
            this.Property(t => t.ImageIds).HasColumnName("ImageIds");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.RelatedToCities).HasColumnName("RelatedToCities");
            this.Property(t => t.IsTop).HasColumnName("IsTop");
        }
    }
}
